<script setup lang="ts">
import {useRouter} from "vue-router";
import {onMounted, ref} from "vue";
import {getCurrentUser} from "../services/user.ts";

// const user = {
//   id: 1,
//   username: '啵啵',
//   userAccount: '123456',
//   avatarUrl: 'https://img0.baidu.com/it/u=1479714859,2343991471&fm=253&app=120&size=w931&n=0&f=JPEG&fmt=auto?sec=1724950800&t=cd2e2a31bae1ae03a562fddc9d4c4fc9',
//   gender: '男',
//   phone: '123456789',
//   email: '12135@qq.com',
//   tags: ['java', 'c++', '大一'],
//   planetCode: '1234',
//   createTime: new Date(),
// };
const user = ref();
onMounted(async () => {
  user.value = await getCurrentUser();
})
const router = useRouter();

const doEdit = (editKey: string, editName: string, currentValue: string) => {
  console.log(editName)
  router.push({
        path: '/user/edit',
        query: {
          editKey,
          editName,
          currentValue,
        }
      }
  );
}

</script>

<template>
  <template v-if="user">
    <van-cell title="当前用户" :value="user?.username" />
    <van-cell title="修改信息" is-link to="/user/update" />
    <van-cell title="我创建的队伍" is-link to="/user/team/create"/>
    <van-cell title="我加入的队伍" is-link to="/user/team/join" />
  </template>
</template>

<style scoped>

</style>